package com.guijq.codesegment.springbean.spring;

import java.lang.reflect.Proxy;

import com.guijq.codesegment.springbean.dao.UserDao;
import com.guijq.codesegment.springbean.dao.UserInvocationHandler;
import org.springframework.beans.factory.FactoryBean;

/**
 * @author yangjf
 * @version 0.1.0
 * @time 2018/12/25/025
 */
public class UserDaoFactoryBean implements FactoryBean {
    @Override
    public Object getObject() throws Exception {
        UserDao userDao = (UserDao) Proxy.newProxyInstance(UserMapperImportBeanDefinitionRegistrar.class.getClassLoader(), new Class[]{UserDao.class}, new UserInvocationHandler());
        return userDao;
    }

    @Override
    public Class<?> getObjectType() {
        return null;
    }
}
